package org.example.service.impl;

import org.example.mapper.FeedbackMapper;
import org.example.pojo.domain.Feedback;
import org.example.service.FeedbackService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

@Service
public class FeedbackServiceImpl implements FeedbackService {

    @Autowired
    private FeedbackMapper feedbackMapper;

    @Override
    public List<Feedback> listFeedbacksByArtifact(Integer artifactId) {
        return feedbackMapper.findByArtifactId(artifactId);
    }

    @Override
    public Feedback getFeedbackById(Integer feedbackId) {
        return feedbackMapper.findById(feedbackId);
    }

    @Override
    public void addFeedback(Feedback feedback) {
        feedbackMapper.insertFeedback(feedback);
    }

    @Override
    public void deleteFeedback(Integer feedbackId) {
        feedbackMapper.deleteFeedback(feedbackId);
    }

    @Override
    public void updateFeedback(Feedback feedback) {
        feedbackMapper.updateFeedback(feedback);
    }
}
